import 'dart:async';

main() {
  // 广播流
  StreamController controller = StreamController.broadcast();
  // 添加广播1
  controller.stream.listen((value) => print("listener1: $value"));
  // 添加数据
  controller.sink.add(1);
  controller.sink.add(2);
  // 添加广播2
  controller.stream.listen((value) => print("listener2: $value"));
  controller.sink.add(3);
  controller.sink.add(4);
  // 关闭
  controller.close();
}